﻿
namespace ProblemsSet
{
    public class Problem_9 : BaseProblem
    {
        public override object GetResult()
        {
            const int summ = 1000;
            for (var a=1; a < summ/2; a++)
            {
                for (var b = a; b < summ/2; b++)
                {
                    var c = summ - a-b;
                    if (a*a+b*b==c*c) return a*b*c;
                }
            }
            return 0;
        }

        public override string Problem
        {
            get
            {
                return @"A Pythagorean triplet is a set of three natural numbers, a  b  c, for which,

a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.";
            }
        }

        public override bool IsSolved
        {
            get
            {
                return true;
            }
        }

        public override object Answer
        {
            get
            {
                return 31875000;
            }
        }
    }
}
